using ExampleMvcApplication.Controllers;
using ExampleMvcApplication.Models.Request;

namespace ExampleMvcApplication.Views.Account
{
    public class Register : Master<RegisterRequest>
    {
        protected override string RenderTitleContent()
        {
            return "Register";
        }

        protected override string RenderMainContent(RegisterRequest model)
        {
            return Children._(
                h2._("Create a New Account"),
                p._("Use the form below to create a new account."),
                p._("Passwords are required to be a minimum of ", model.MinPasswordLength, " characters in length."),
                RenderErrorSummary(),
                form.action(UrlResolver.UrlFor<AccountController>(x => x.Register(default(RegisterRequest)))).method("post")._(
                    input.type("hidden").name("returnUrl").value(model.ReturnUrl),
                    div._(
                        fieldset._(
                            legend._("Account Information"),
                            p._(
                                label._for("username")._("Username:"),
                                input.type("text").name("username")
                                ),
                            p._(
                                label._for("email")._("Email:"),
                                input.type("text").name("email")
                                ),
                            p._(
                                label._for("password")._("Password:"),
                                input.type("password").name("password")
                                ),
                            p._(
                                label._for("confirmPassword")._("Confirm Password:"),
                                input.type("password").name("confirmPassword")
                                ),
                            p._(
                                input.type("submit").value("Register")
                                )
                            )
                        )
                    )
                );
        }
    }
}